Skip to content

auth: avoid duplicate getpwnam lookup#665

Open
Komzpa wants to merge 1 commit into
openssh:masterfrom
Komzpa:fixer-auth-getpwnamallow
Open

auth: avoid duplicate getpwnam lookup#665
Komzpa wants to merge 1 commit into
openssh:masterfrom
Komzpa:fixer-auth-getpwnamallow

Conversation

@Komzpa
Copy link
Copy Markdown
Contributor

@Komzpa Komzpa commented May 26, 2026

Summary

getpwnamallow() called getpwnam(user) once to fill
ci->user_invalid before Match processing, then called it again for the
returned passwd record.

Reuse the first lookup on non-AIX systems. On AIX, keep the second lookup after
aix_setauthdb(user), preserving the existing auth database switch semantics
before restoring the previous auth database.

Tests

  • autoreconf && ./configure --prefix=/tmp/openssh-auth-getpwnamallow-install && make -j8
  • make LTESTS='cfgmatch allow-deny-users authinfo' t-exec

getpwnamallow() used getpwnam() to fill ci->user_invalid for Match processing, then called getpwnam() again for the returned passwd record.

Reuse the first lookup on non-AIX systems. Keep the second lookup under AIX after aix_setauthdb(), preserving the auth database switch semantics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant